'use strict';

angular.module('CBO').controller('WareHouseListController', ['$scope', 'BaseModule', 'BaseEnum', 'ProduceWorkEnum', '$location', 'Authentication',
    function($scope, BaseModule, BaseEnum, ProduceWorkEnum, $location, Authentication) {
        $scope.DeliveryModeEnum = ProduceWorkEnum.DeliveryMode;
        $scope.PushPullModeEnum = ProduceWorkEnum.PushPullMode;

    	BaseModule.initModule($scope, 'WareHouse');
        $scope.Module.WareHouse.LoadMode = BaseEnum.LoadMode.CacheAndPaging;
        $scope.Module.WareHouse.PageSize = 15;
        $scope.Module.WareHouse.Populate = {path: 'Department', select: 'Code Name'};

        $scope.btnAdd = function(){
        	$location.url('/index/WareHouse/Edit');
        };

        $scope.rowDblClick = function(){
            $scope.$apply(function(){
                $location.url("/index/WareHouse/Edit/" + $scope.Module.WareHouse.FocusedRecord._id);
            });
        };

        $scope.btnDelete = function(){
        	$scope.Module.WareHouse.deleteSelecteds();
        };
    }
]);